<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title><?php echo $title;?></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../public/plugin/layui/css/layui.css" media="all">
  <script src="../../public/js/jquery.js"></script>
</head>
<body>

  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card">
          <div class="layui-card-header" style="padding-top:30px;"><?php echo $title;?></div>
          <div class="layui-card-body" pad15>
            
            <div class="layui-form">
			
			
              <div class="layui-form-item">
				<label class="layui-form-label">题目类型</label>
				<div class="layui-input-inline">
                  <input type="text" name="name" id="name" placeholder="请输入类型名" class="layui-input">
                </div>
              </div>
              
              <div class="layui-form-item">
                <div class="layui-input-block">
                  <button class="layui-btn" id="add">添加</button>
                  <button type="reset" id="reset" class="layui-btn layui-btn-primary">重新填写</button>
                </div>
              </div>
            </div>
         
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
</html>
<script src="../../public/plugin/layer/layer.js"></script>
<script>
/***清空表单****/
	$(function(){
		$("#reset").click(function(){
			$("input").val("");
		});
		
		$("#add").click(function(){
			var name = $("#name").val();
			if(name == ''){
				layer.alert('不能为空！');
				$("#add").focus();
				return false;
			}
				
			$.ajax({
				type:'post',
				data:{"type_name":name},
				url:'ajaxAddQType.php',
				success:function(data){
					if(data=='类型已存在！'){
						layer.msg(data,{icon: 5,time:2000});
					}else if(data== '<span style="color:green;font-weight:bold;">添加成功</span>'){
						layer.msg(data,{icon: 1,time:2000});
					}
					else{
						layer.msg(data,{icon: 2,time:2000});
					}
				}
			});
			
		});
	});
	
</script>